package com.design.yjx.observer.custom;

/**
 * @author yuanjianxin
 * @date 2017/8/2 16:59
 */
public class Main {
    public static void main(String[] args) {
        //主题
        WeatherData weatherData = new WeatherData();

        //观察者
        CurrentConditionsDisplay currentConditionsDisplay = new CurrentConditionsDisplay(weatherData);
        HeatIndexDisplay heatIndexDisplay = new HeatIndexDisplay(weatherData);

        //模拟天气相关指数变化
        weatherData.setMeasurements(23,80,100);
        weatherData.setMeasurements(25,85,110);
        weatherData.setMeasurements(20,85,110);

        System.out.println("酷热指数面板取消订阅...");
        weatherData.removeObserver(heatIndexDisplay);
        weatherData.setMeasurements(20,85,110);


    }
}
